/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package num7;

import java.util.ArrayList;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Usuário
 */
public class ListaAntiga extends ListaTemplate{

    //ArrayList<ListaModel> lista = new ArrayList<ListaModel>();

    public ListaAntiga(menuView view) {
        listaTels(view);
    }
    
    
  
    @Override
    public void exibirListaSolicitada(ArrayList<ListaModel> li, menuView view) {
        //ArrayList<ListaModel> lEdit = editarLista(li);
        ArrayList<ListaModel> lEdit = li;
        view.setVisible(true);
        
        Object colunas[] = {"ID", "UF", "Nome", "Numero", "Operadora"};
        DefaultTableModel tmUsuario = new DefaultTableModel(colunas, 0) {
            @Override
            public boolean isCellEditable(int row, int col) {
                if (col == 0 || col == 1) {
                    return false;
                } else {
                    return true;
                }
            }
        };
        for (int i = 0; i < lEdit.size(); i++) {
            ListaModel l = lEdit.get(i);
            tmUsuario.addRow(new Object[]{l.getNome(), l.getId(), l.getNumero()});            
        }
        view.getTableListaAtualizada().setModel(tmUsuario);
    }
}
